package com.ruoyi.community.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.community.mapper.ServiceProblemsMapper;
import com.ruoyi.community.domain.ServiceProblems;
import com.ruoyi.community.service.IServiceProblemsService;

/**
 * 问卷调查Service业务层处理
 * 
 * @author 袁现程
 * @date 2021-08-01
 */
@Service
public class ServiceProblemsServiceImpl implements IServiceProblemsService 
{
    @Autowired
    private ServiceProblemsMapper serviceProblemsMapper;

    /**
     * 查询问卷调查
     * 
     * @param id 问卷调查ID
     * @return 问卷调查
     */
    @Override
    public ServiceProblems selectServiceProblemsById(Long id)
    {
        return serviceProblemsMapper.selectServiceProblemsById(id);
    }

    /**
     * 查询问卷调查列表
     * 
     * @param serviceProblems 问卷调查
     * @return 问卷调查
     */
    @Override
    public List<ServiceProblems> selectServiceProblemsList(ServiceProblems serviceProblems)
    {
        serviceProblems.setCommunityId(Long.valueOf(SecurityUtils.getCommunityId()));
        return serviceProblemsMapper.selectServiceProblemsList(serviceProblems);
    }

    /**
     * 新增问卷调查
     * 
     * @param serviceProblems 问卷调查
     * @return 结果
     */
    @Override
    public int insertServiceProblems(ServiceProblems serviceProblems)
    {
        serviceProblems.setCommunityId(Long.valueOf(SecurityUtils.getCommunityId()));
        serviceProblems.setStatus(false);
        serviceProblems.setCreateTime(DateUtils.getNowDate());
        return serviceProblemsMapper.insertServiceProblems(serviceProblems);
    }

    /**
     * 修改问卷调查
     * 
     * @param serviceProblems 问卷调查
     * @return 结果
     */
    @Override
    public int updateServiceProblems(ServiceProblems serviceProblems)
    {
        return serviceProblemsMapper.updateServiceProblems(serviceProblems);
    }

    /**
     * 批量删除问卷调查
     * 
     * @param ids 需要删除的问卷调查ID
     * @return 结果
     */
    @Override
    public int deleteServiceProblemsByIds(Long[] ids)
    {
        return serviceProblemsMapper.deleteServiceProblemsByIds(ids);
    }

    /**
     * 删除问卷调查信息
     * 
     * @param id 问卷调查ID
     * @return 结果
     */
    @Override
    public int deleteServiceProblemsById(Long id)
    {
        return serviceProblemsMapper.deleteServiceProblemsById(id);
    }
}
